home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # createupdates - create the necessary file to support the rlupdate
- # program
- # copyright (c) 2001 Joseph Cheek, Redmond Linux Corp. Released under
- # GPL.
-
- FTPBASEDIR=/home/ftp
- RLBASEDIR=$FTPBASEDIR/pub/linux/redmondlinux
- UPDATEBASEDIR=$RLBASEDIR/updates/amethyst-personal
- RPMSBASEDIR=$UPDATEBASEDIR/RPMS
-
-
- _getrpmlist() {
- #return a list of all RPM files in dir $1
-
- ls "$1/"*.rpm | cat
-
- }
-
-
- _createupdates_xml() {
-
-
- __createupdates_header() {
-
- cat << EOF
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE updatelist SYSTEM "updates.dtd">
- <updatelist>
- EOF
-
- }
-
-
- __createupdates_body() {
- # create the body for package $1 according to the following pattern:
-
- # <update category="security">
- # <name>XFree86</name>
- # <date>2000/05/26</date>
- # <url>ftp://ftp.calderasystems.com/pub/security/CSSA-2000-012.0.txt</url>
- # <synopsis>
- # A bug was discovered in the X server's authentication code that
- # allows a remote user to completely hang the victim's X server
- # </synopsis>
- # <package demand="required" action="install">
- # <query>XFree86</query>
- # <name>XFree86</name>
- # <version>3.3.6-4</version>
- # <arch>i386</arch>
- # <size>824777</size>
- # </package>
- # </update>
-
- _UP_CATEGORY="new build"
- _UP_NAME=`rpmextr --tag=name $1`
- _UP_DATE=`date +%Y/%m/%d`
- _UP_URL="http://www.redmondlinux.org/"
- _UP_SYNOPSIS="Updated for build $LATEST_BUILD"
- _PKG_DEMAND="required"
- _PKG_ACTION="install"
- _PKG_QUERY=`rpmextr --tag=name $1`
- _PKG_NAME=`rpmextr --tag=summary $1 | sed s/\&/and/g`
- _PKG_VERSION=`rpmextr --tag=version $1`-`rpmextr --tag=release $1`
- _PKG_ARCH=`echo $1 | tr . \\\\n | tail -n 2 | head -n 1`
- _PKG_SIZE=`ls -l $1 | tr -s \ | cut -d \ -f 5`
-
- # echo \# $1
-
- cat << EOF
-
-
- <update category="$_UP_CATEGORY">
- <name>$_UP_NAME</name>
- <date>$_UP_DATE</date>
- <url>$_UP_URL</url>
- <synopsis>
- $_UP_SYNOPSIS
- </synopsis>
- <package demand="$_PKG_DEMAND" action="$_PKG_ACTION">
- <query>$_PKG_QUERY</query>
- <name>$_PKG_NAME</name>
- <version>$_PKG_VERSION</version>
- <arch>$_PKG_ARCH</arch>
- <size>$_PKG_SIZE</size>
- </package>
- </update>
- EOF
-
- }
-
-
- __createupdates_footer() {
-
- cat << EOF
- </updatelist>
- EOF
-
- }
-
- local filename FILES;
-
- __createupdates_header > $UPDATEBASEDIR/updates.xml
-
- FILES=`_getrpmlist $RPMSBASEDIR` || return 1
-
- for filename in $FILES; do
- __createupdates_body $filename >> $UPDATEBASEDIR/updates.xml
- done
-
- __createupdates_footer >> $UPDATEBASEDIR/updates.xml
-
- }
-
-
- _signupdates_xml() {
-
- gpg --yes -sb $UPDATEBASEDIR/updates.xml || return 1
-
- }
-
-
- _getlatestbuild() {
-
- echo -n What is the latest build \#\?\
- read LATEST_BUILD
-
- }
-
-
- _exit_error() {
-
- echo $* >&2
- exit 1
-
- }
-
-
- # main()
-
- _getlatestbuild || _exit_error "could not get latest build #"
- _createupdates_xml || _exit_error "could not create updates.xml file"
- _signupdates_xml || _exit_error "could not sign updates.xml file"
-
- exit 0
-